<?php
                include("global.php"); 
                printHeader(false);
                session_start();
                $sezione = $_GET["sezioni"]; 
                $dataS = $_GET["dataS"]; 
                $dataE = $_GET["dataE"]; 
//                $dataS=date("Y-m-d H:i",strtotime("$dataS"));
//                $dataE=date("Y-m-dd",strtotime("06/13/2011 19:17"));
                list($day,$month,$year,$hour,$minutes) = preg_split('/[ :\/]+/', $dataS);
                $dataS="$year-$month-$day $hour $minutes";
                list($day,$month,$year,$hour,$minutes) = preg_split('/[ :\/]+/', $dataE);
                $dataE="$year-$month-$day $hour $minutes";
                
                $sezioni = explode(",", $sezione);
               
                
                
                if(!isset($_GET['makeFile']))
                {
?>
 <?php 
 $result=selectDatiDb($dataS,$dataE,$sezioni);
 if($result["numero_righe"] > 0)
 {

 ?>    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
            <link rel="stylesheet" type="text/css" href="style/themes/blue/style.css"/> 
             
            
	</head>
    <body> 
            
                <fieldset class="formular" id="formular"><legend>Dati Impianto</legend>
                    <table cellspacing="1" class="tablesorter" id="myTable"> 
                            <thead>
                                    <tr>
                                        <?php print selectHeaderSezioni(); ?>     
                                    </tr>
                            </thead>
                                 <tfoot>
                                <tr>
                                        <td colspan="<?php echo count($sezioni); ?>" ><em>Elenco elementi dati impianto</em></td>
                                        <td class="rounded-foot-right">&nbsp;</td>
                                </tr>
                            </tfoot>
                            <tbody>
                                    <?php
                                    print($result["html"]);
                                    
                                    ?>
                            </tbody>
                    </table>
                </fieldset>
                <br></br>

                <div id="pager" class="pager">
                <form>
                        <img src="images/icon/first.png" class="first"/>
                        <img src="images/icon/prev.png" class="prev"/>
                        <input type="text" class="pagedisplay"/>
                        <img src="images/icon/next.png" class="next"/>
                        <img src="images/icon/last.png" class="last"/>
                        <select class="pagesize">
                                <option selected="selected"  value="10">10</option>
                                <option value="20">20</option>
                                <option value="30">30</option>
                                <option  value="40">40</option>
                        </select>
                </form>
                </div>
              

	</body>
</html>
<?php
 }
}
else
{
    MakeWriter($dataS,$dataE,$sezioni);
}
?>
